import uniqueId from '@form-create/utils/lib/unique'
import { localeProps } from '../utils'

export const useEditorRule = () => {
  const label = '富文本框'
  const name = 'Editor'
  return {
    icon: 'icon-editor',
    label,
    name,
    rule() {
      return {
        type: name,
        field: uniqueId(),
        title: label,
        info: '',
        $required: false,
        props: {}
      }
    },
    props(_, { t }) {
      return localeProps(t, name + '.props', [
        // makeRequiredRule(),
        {
          type: 'input',
          field: 'height',
          title: '高度',
          value: '500px'
        },
        {
          type: 'input',
          field: 'placeholder',
          title: '输入框占位文本',
          value: '请输入内容'
        },
        { type: 'switch', field: 'disabled', title: '是否禁用/只读' }
      ])
    }
  }
}
